﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Data.SqlClient;

/// <summary>
/// Summary description for Class1
/// </summary>
/// 

namespace Bestlife.ERP.DataAccess
{

    public class Connection
    {
        public static SqlConnection con =new SqlConnection();

        public static SqlConnection connect(string connectionString)
        {
            if (con.State != System.Data.ConnectionState.Open)
            {

                con.ConnectionString = connectionString;
                con.Open();
            }
            else
            {
                return null;
            }
            return con;
        }

        public static SqlDataReader ReadTable(string strReadStr)
        {
            SqlCommand COMMA = new SqlCommand(strReadStr, con);
            SqlDataReader rdNew;
            rdNew = COMMA.ExecuteReader();
            return rdNew;
        }

        public static Boolean AddEditDel(string strAddEditDel)
        {
            SqlCommand ADDCOM = new SqlCommand(strAddEditDel, con);
            int a;
            a = ADDCOM.ExecuteNonQuery();
            if (a == 0)
                return false;
            else
                return true;

        }

    }

}